package com.andova.esgl.sample

import android.opengl.GLSurfaceView
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.andova.egl.VAO
import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.opengles.GL10

class VAOActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val glsv = GLSurfaceView(this)
        setContentView(glsv)
        glsv.setEGLContextClientVersion(3)
        glsv.setRenderer(VAORender())
    }
}

class VAORender : GLSurfaceView.Renderer {
    override fun onDrawFrame(gl: GL10?) = run { VAO.drawFrame() }
    override fun onSurfaceCreated(gl: GL10?, config: EGLConfig?) = run { VAO.surfCreated() }
    override fun onSurfaceChanged(gl: GL10?, width: Int, height: Int) = run { VAO.surfChanged(width, height) }
}